{extend name="index_layout"/}
{block name="main"}
<div class="layui-card layer-popup">
    <div class="layui-card-body">
        <form class="layui-form layui-form-pane" lay-filter="form">
            <div class="layui-form-item">
                <label class="layui-form-label">所属等级</label>
                <div class="layui-input-inline">
                    <select name="level_id" lay-verify="required">
                        <option value="">请选择等级</option>
                        {volist name="userLevel" id="vo"}
                        <option value="{$vo.id}" {if !empty($info) && $info.level_id==$vo.id} selected {/if} >{$vo.name}</option>
                        {/volist}
                    </select>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">所属分组</label>
                <div class="layui-input-inline">
                    <select name="group_id" lay-verify="required">
                        <option value="">请选择等级</option>
                        {volist name="userGroup" id="vo"}
                        <option value="{$vo.id}" {if !empty($info) && $info.group_id==$vo.id} selected {/if} >{$vo.name}</option>
                        {/volist}
                    </select>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">用户名</label>
                <div class="layui-input-inline">
                    <input type="text" name="username" lay-verify="required" placeholder="{:lang('pleaseEnter')}昵称" class="layui-input">
                </div>
                <div class="layui-form-mid layui-word-aux">
                    在4到25个字符之间。
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">手机</label>
                <div class="layui-input-inline">
                    <input type="text" name="mobile" placeholder="{:lang('pleaseEnter')}手机" lay-verify="phone" class="layui-input">
                </div>
                <div class="layui-form-mid layui-word-aux">
                    必须是正确的手机号
                </div>
            </div>

            <div class="layui-form-item item-flex">
                <label class="layui-form-label">头像</label>
                <div class="layui-input-inline item-wide border-none">
                    <div class="js-upload-image">
                        {if $info}
                        {php}echo \util\Form::images('avatar','',$info['avatar']);{/php}
                        {else}
                        {php}echo \util\Form::images('avatar');{/php}
                        {/if}
                    </div>
                </div>
            </div>


            <div class="layui-form-item">
                <label class="layui-form-label">{:lang('email')}</label>
                <div class="layui-input-inline">
                    <input type="text" name="email" lay-verify="email" placeholder="{:lang('pleaseEnter')}邮箱" class="layui-input">
                </div>

            </div>
            <div class="layui-form-item" pane>
                <label class="layui-form-label">{:lang('sex')}</label>
                <div class="layui-input-block">
                        <input type="radio" name="sex" lay-filter="sex" checked value="1" title="男">
                        <input type="radio" name="sex" lay-filter="sex" value="2" title="女">
                        <input type="radio" name="sex" lay-filter="sex" value="0" title="保密">
                </div>
            </div>

            <div class="layui-form-item layer-footer">
                <div>
                    <input type="hidden" name="id">
                    <button type="button" class="layui-btn" lay-submit="" lay-filter="submit"><i class="layui-icon layui-icon-form"></i> {:lang('submit')}</button>
                    <button type="reset" class="layui-btn layui-btn-primary"> <i class="layui-icon layui-icon-delete"></i>{:lang('reset')}</button>
                </div>
            </div>
        </form>
    </div>
</div>
{/block}
{block name="script"}

<script type="text/javascript">
    layui.use(['form','yznForm'], function() {
        var yznForm = layui.yznForm;
        var form = layui.form;
        yznForm.listen();

        var info = '';
        info = {:json_encode($info)};
        form.val("form", info);
        if(info){
            $('#addPic').attr('src',info.avatar);
        }
    });
</script>

{/block}